home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / Credits.aspx.cs54 < prev    next >
Text File  |  2008-03-01  |  12KB  |  336 lines

  1. //===========================================================================
  2. // This file was modified as part of an ASP.NET 2.0 Web project conversion.
  3. // The class name was changed and the class modified to inherit from the abstract base class 
  4. // in file 'App_Code\Migrated\Stub_Credits_aspx_cs.cs'.
  5. // During runtime, this allows other classes in your web application to bind and access 
  6. // the code-behind page using the abstract base class.
  7. // The associated content page 'Credits.aspx' was also modified to refer to the new class name.
  8. // For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/?LinkId=46995 
  9. //===========================================================================
  10. using System;
  11. using System.Collections;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.IO;
  16. using System.Web;
  17. using System.Web.SessionState;
  18. using System.Web.UI;
  19. using System.Web.UI.WebControls;
  20. using System.Web.UI.HtmlControls;
  21. using GBPVRSchedule;
  22. using gbweb.classes;
  23. using GBPVR.Public;
  24.  
  25. namespace gbweb
  26. {
  27.     /// <summary>
  28.     /// Summary description for Credits.
  29.     /// </summary>
  30.     public partial class Migrated_Credits : Credits
  31.     {
  32.  
  33.         private Settings guideParams;
  34.         protected string programUniqueIdentifier;
  35.     
  36.         protected void Page_Load(object sender, System.EventArgs e)
  37.         {
  38.             getTheme();
  39.             guideParams = Global.Settings;
  40.             
  41.             if (!IsPostBack) 
  42.             {
  43.                 
  44.                 Schedule scheduleHelper = Global.Schedule;
  45.                 Programme programme = null;
  46.  
  47.                 programme = scheduleHelper.GetProgrammeByOID(int.Parse(Request.Params["id"]));
  48.                 // show programme details
  49.                 showTitle.Text = programme.getTitle();
  50.                 programUniqueIdentifier = programme.getUniqueProgrammeIdentifier();
  51.                 showSubTitle.Text = programme.getSubTitle();
  52.  
  53.                 bool ExtendedEWAEnabled = ExtendedEWA.Initialize();
  54.  
  55.                 string description = DetailDisplay.getDetailDisplay(programme);
  56.  
  57.                 if (ExtendedEWAEnabled)
  58.                 {
  59.                     //Open the ExtendedEWA DB
  60.                     ExtendedEWA.OpenExtendedEWADB();
  61.  
  62.                     //Pull all the cast/crew found for the show
  63.                     ArrayList cast = ExtendedEWA.GetCast(programme.getUniqueProgrammeIdentifier());
  64.  
  65.                     //Close the ExtendedEWA DB
  66.                     ExtendedEWA.CloseExtendedEWADB();
  67.  
  68.                     //If any cast was found load up the information
  69.                     if (cast.Count > 0)
  70.                     {
  71.                         //Create the table arrays to hold any found crew
  72.                         ArrayList Actors        = new ArrayList();
  73.                         ArrayList Directors        = new ArrayList();
  74.                         ArrayList Producers        = new ArrayList();
  75.                         ArrayList Writers        = new ArrayList();
  76.                         ArrayList ExecProducers = new ArrayList();
  77.                         ArrayList GuestStars    = new ArrayList();
  78.                         ArrayList Hosts            = new ArrayList();
  79.                         ArrayList Narrators     = new ArrayList();
  80.                         ArrayList Judges        = new ArrayList();
  81.                         ArrayList Contestants   = new ArrayList();
  82.                         ArrayList Guests        = new ArrayList();
  83.  
  84.                         foreach (ExtendedEWA.Crew crew in cast)
  85.                         {
  86.                             switch (crew.Role)
  87.                             {
  88.                                 case ExtendedEWA.Role.Actor:
  89.                                     Actors.Add(crew);
  90.                                     break;
  91.                                 case ExtendedEWA.Role.Director:
  92.                                     Directors.Add(crew);
  93.                                     break;
  94.                                 case ExtendedEWA.Role.Producer:
  95.                                     Producers.Add(crew);
  96.                                     break;
  97.                                 case ExtendedEWA.Role.Writer:
  98.                                     Writers.Add(crew);
  99.                                     break;
  100.                                 case ExtendedEWA.Role.ExecProducer:
  101.                                     ExecProducers.Add(crew);
  102.                                     break;
  103.                                 case ExtendedEWA.Role.GuestStar:
  104.                                     GuestStars.Add(crew);
  105.                                     break;
  106.                                 case ExtendedEWA.Role.Host:
  107.                                     Hosts.Add(crew);
  108.                                     break;
  109.                                 case ExtendedEWA.Role.Narrator:
  110.                                     Narrators.Add(crew);
  111.                                     break;
  112.                                 case ExtendedEWA.Role.Judge:
  113.                                     Judges.Add(crew);
  114.                                     break;
  115.                                 case ExtendedEWA.Role.Contestant:
  116.                                     Contestants.Add(crew);
  117.                                     break;
  118.                                 case ExtendedEWA.Role.Guest:
  119.                                     Guests.Add(crew);
  120.                                     break;
  121.                             }
  122.                         }
  123.  
  124.                         //Create first table header row
  125.                         TableRow headerRow = new TableRow();
  126.  
  127.                         //Load the header row with the titles
  128.                         TableCell actors = new TableCell();
  129.                         actors.Text = "<b>Actors</b>";
  130.                         actors.CssClass = "header";
  131.                         actors.Width = 60;
  132.                         actors.Wrap = false;
  133.                         headerRow.Cells.Add(actors);
  134.  
  135.                         TableCell directors = new TableCell();
  136.                         directors.Text = "<b>Directors</b>";
  137.                         directors.CssClass = "header";
  138.                         directors.Width = 60;
  139.                         directors.Wrap = false;
  140.                         headerRow.Cells.Add(directors);
  141.  
  142.                         TableCell producers = new TableCell();
  143.                         producers.Text = "<b>Exec. Producers</b>";
  144.                         producers.CssClass = "header";
  145.                         producers.Width = 60;
  146.                         producers.Wrap = false;
  147.                         headerRow.Cells.Add(producers);
  148.  
  149.                         TableCell writers = new TableCell();
  150.                         writers.Text = "<b>Producers</b>";
  151.                         writers.CssClass = "header";
  152.                         writers.Width = 60;
  153.                         writers.Wrap = false;
  154.                         headerRow.Cells.Add(writers);
  155.  
  156.                         TableCell execproducers = new TableCell();
  157.                         execproducers.Text = "<b>Writers</b>";
  158.                         execproducers.CssClass = "header";
  159.                         execproducers.Width = 60;
  160.                         execproducers.Wrap = false;
  161.                         headerRow.Cells.Add(execproducers);
  162.  
  163.                         TableCell gueststars = new TableCell();
  164.                         gueststars.Text = "<b>Guest Stars</b>";
  165.                         gueststars.CssClass = "header";
  166.                         gueststars.Width = 60;
  167.                         gueststars.Wrap = false;
  168.                         headerRow.Cells.Add(gueststars);
  169.  
  170.                         TableCell hosts = new TableCell();
  171.                         hosts.Text = "<b>Hosts</b>";
  172.                         hosts.CssClass = "header";
  173.                         hosts.Width = 60;
  174.                         hosts.Wrap = false;
  175.                         headerRow.Cells.Add(hosts);
  176.  
  177.                         TableCell narrators = new TableCell();
  178.                         narrators.Text = "<b>Narrators</b>";
  179.                         narrators.CssClass = "header";
  180.                         narrators.Width = 60;
  181.                         narrators.Wrap = false;
  182.                         headerRow.Cells.Add(narrators);
  183.  
  184.                         TableCell judges = new TableCell();
  185.                         judges.Text = "<b>Judges</b>";
  186.                         judges.CssClass = "header";
  187.                         judges.Width = 60;
  188.                         judges.Wrap = false;
  189.                         headerRow.Cells.Add(judges);
  190.  
  191.                         TableCell contestants = new TableCell();
  192.                         contestants.Text = "<b>Contestants</b>";
  193.                         contestants.CssClass = "header";
  194.                         contestants.Width = 60;
  195.                         contestants.Wrap = false;
  196.                         headerRow.Cells.Add(contestants);
  197.  
  198.                         TableCell guests = new TableCell();
  199.                         guests.Text = "<b>Guests</b>";
  200.                         guests.CssClass = "header";
  201.                         guests.Width = 60;
  202.                         guests.Wrap = false;
  203.                         headerRow.Cells.Add(guests);
  204.  
  205.                         CreditsTable.Rows.Add(headerRow);
  206.                     
  207.                         //Load the rows with data
  208.                         while (
  209.                             (Actors.Count            > 0) || 
  210.                             (Directors.Count        > 0) ||     
  211.                             (Producers.Count        > 0) ||     
  212.                             (Writers.Count            > 0) || 
  213.                             (ExecProducers.Count    > 0) || 
  214.                             (GuestStars.Count        > 0) ||
  215.                             (Narrators.Count        > 0) ||
  216.                             (Judges.Count           > 0) ||
  217.                             (Hosts.Count            > 0) ||
  218.                             (Contestants.Count      > 0) ||
  219.                             (Guests.Count > 0))
  220.                         {
  221.                             TableRow crewRow = new TableRow();
  222.                             AddCell(crewRow, Actors            );
  223.                             AddCell(crewRow, Directors        );
  224.                             AddCell(crewRow, ExecProducers    );
  225.                             AddCell(crewRow, Producers        );
  226.                             AddCell(crewRow, Writers        );
  227.                             AddCell(crewRow, GuestStars        );
  228.                             AddCell(crewRow, Hosts            );
  229.                             AddCell(crewRow, Narrators      );
  230.                             AddCell(crewRow, Judges         );
  231.                             AddCell(crewRow, Contestants    );
  232.                             AddCell(crewRow, Guests         );
  233.                             CreditsTable.Rows.Add(crewRow);
  234.                         }
  235.                     }
  236.                     else
  237.                     {
  238.                         //Load the header row with the titles
  239.                         //Create first table header row
  240.                         TableRow headerRow = new TableRow();
  241.                         TableCell noactors = new TableCell();
  242.  
  243.                         noactors.Text = "<b>No Credits Available</b>";
  244.                         noactors.CssClass = "header";
  245.                         noactors.Width = 75;
  246.                         noactors.Wrap = false;
  247.                         headerRow.Cells.Add(noactors);
  248.                         CreditsTable.Rows.Add(headerRow);
  249.                     }
  250.                 }
  251.  
  252.                 
  253.                 //Load the show description/date/channel
  254.                 TableCell desc = new TableCell();
  255.                 desc.Text = description;
  256.                 TableRow descRow = new TableRow();
  257.                 descRow.Cells.Add(desc);
  258.                 ShowDescTable.Rows.Add(descRow);
  259.  
  260.                 showStartDate.Text = programme.getStartTime().ToLongDateString();
  261.                 showTimes.Text = programme.getStartTime().ToShortTimeString() + " - " + programme.getEndTime().ToShortTimeString();
  262.  
  263.                 Channel channel = scheduleHelper.GetChannelByOID(programme.getChannelOID());
  264.                 string channelName = channel.getName();
  265.                 if (channelName.StartsWith(channel.getChannelNumber().ToString())) // cosmetic stuff for my american friends
  266.                 {
  267.                     channelName = channelName.Substring(channel.getChannelNumber().ToString().Length);
  268.                 }
  269.                 
  270.                 showChannel.Text = "<span class=\"channelnumber\"><b>" + channel.getChannelNumber() + "</b></span> (<span class=\"channelname\"><nobr>" + channelName + "</nobr></span>)";
  271.  
  272.             }
  273.         }
  274.  
  275.         private void AddCell(TableRow crewRow, ArrayList crewlist)
  276.         {
  277.             if (crewlist.Count > 0)
  278.             {
  279.                 ExtendedEWA.Crew crew = (ExtendedEWA.Crew)crewlist[0];
  280.                 crewlist.Remove(crew);
  281.                 TableCell cell = new TableCell();
  282.                 cell.Text = "<a href=\"http://www.imdb.com/Find?for=" + crew.GivenName + " " + crew.SurName + "\" onclick=\"EditPop2(this,'IMDB');return false;\">" + crew.GivenName + " " + crew.SurName + "</a>";
  283.                 crewRow.Cells.Add(cell);
  284.             }
  285.             else
  286.             {
  287.                 crewRow.Cells.Add(new TableCell());
  288.             }
  289.         }
  290.  
  291.         private void getTheme()
  292.         {
  293.             string theme = System.Convert.ToString(Session["theme"]);
  294.  
  295.             if (theme != null && theme != "")
  296.             {
  297.                 return;
  298.             }
  299.             else
  300.             {
  301.                 HttpCookie cookie = Request.Cookies["theme"];
  302.                 if (cookie != null && cookie.Value.Length > 0)
  303.                 {
  304.                     theme = cookie.Value;
  305.                 }
  306.                 else
  307.                 {
  308.                     theme = "Default";
  309.                 }
  310.                 Session["theme"] = "themes/" + theme;
  311.                 return;
  312.             }
  313.         }
  314.  
  315.         #region Web Form Designer generated code
  316.         override protected void OnInit(EventArgs e)
  317.         {
  318.             //
  319.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  320.             //
  321.             InitializeComponent();
  322.             base.OnInit(e);
  323.         }
  324.         
  325.         /// <summary>
  326.         /// Required method for Designer support - do not modify
  327.         /// the contents of this method with the code editor.
  328.         /// </summary>
  329.         private void InitializeComponent()
  330.         {    
  331.  
  332.         }
  333.         #endregion
  334.     }
  335. }
  336.